﻿
var connection = require("../../app_modules/dbAccess/mongoConfig.js");
var mongoose = require('mongoose');
var db = mongoose.createConnection(connection.getConnectionString("")); //连接test数据库
//var db = mongoose.Connection(connection.getConnectionString(""));

var Schema = mongoose.Schema; //创建模型【骨架模板】
var adminUserchema = new Schema({
    usercode: String,
    password: String,
    token: String,
    expiredDate: Date,
    active: String,
});

adminUserchema.methods.add = function (adminUser, callback) {
   this.usercode = adminUser.usercode;
    this.password = adminUser.password;
    this.token = adminUser.token;
    this.expiredDate = adminUser.expiredDate;
    this.active = adminUser.active;
    this.save(callback);
}
var adminUser = db.model('adminUsers', adminUserchema);
module.exports = adminUser;
